package com.iss.demo.service;

import com.iss.demo.dao.CarDao;
import com.iss.demo.entity.Car;
import com.iss.demo.model.CarModel;
import org.apache.ibatis.annotations.Insert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarService {
    @Autowired
    private CarDao dao;

    public List<CarModel> selectAll(){return dao.selectAll();}
    public List<CarModel> selectInventory(){return dao.selectInventory();}
    public List<CarModel> selectAllByType(String t_name){return dao.selectAllByType(t_name);}
    public List<CarModel> selectAllByBrand(String b_name){return dao.selectAllByBrand(b_name);}
    public CarModel selectAllByName(String c_name){return dao.selectAllByName(c_name);}
    public CarModel selectAllById(Integer c_id){return dao.selectAllById(c_id);}
    public List<CarModel> selectAllByOther(String t_name,String b_name,Integer c_min_price,Integer c_max_price){
        return dao.selectAllByOther(t_name,b_name,c_min_price,c_max_price);}
    public Integer insertCar(Car car){return dao.insertCar(car);}
    public Integer insertInventory(Car car){return dao.insertInventory(car);}
    public Integer updateCar(Car car){return dao.updateCar(car);}
    public Car selectById(Integer id){return dao.selectById(id);}
    public Integer updateCarInfo(String surface,Integer id){
        return dao.updateInfo(surface,id);
    }
    public Integer delete(Integer c_ids[]){
        return dao.delete(c_ids);
    }
    public Integer deleteInventory(Integer in_id){
        return dao.deleteInventory(in_id);
    }

}
